package com.zy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author LittleDesire
 * @description
 * @date 2022-03-31 周四 11:03
 * @since 17
 */
@Controller
public class IndexController {
    @RequestMapping("index")
    public String index(Model m) {
        m.addAttribute("msg", "success。。。。");
        return "index";
    }

    @GetMapping("clock") @ResponseBody
    public String clock() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }

}
